package io.github.talelin.latticy.controller.api;

import com.aliyuncs.exceptions.ClientException;
import io.github.talelin.latticy.common.AliyunUtil;
import io.github.talelin.latticy.dto.SendMobileDTO;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/api/aliyun")
public class AliyunClass
{
    /**
     * 发送短信验证码
     */
    @PostMapping("/sms")
    public Map<String, Object> send(@RequestBody @Validated SendMobileDTO dto) throws ClientException {
        return AliyunUtil.sendSms(dto.getMobile());
    }

}
